<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ts_menuinfo.*" %>
<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	Map ts_menuinfo = new Hashtable();
	String s_up_menu_id = "000000000000000";
	if(request.getParameter("s_up_menu_id")!=null && !request.getParameter("s_up_menu_id").equals("")){
		s_up_menu_id = request.getParameter("s_up_menu_id");
	}
	ts_menuinfo.put("up_menu_id",s_up_menu_id);
	
	String s_menu_name = "";
	if(request.getParameter("s_menu_name")!=null && !request.getParameter("s_menu_name").equals("")){
		s_menu_name = request.getParameter("s_menu_name");
	}
	ts_menuinfo.put("menu_name",s_menu_name);	
	
	String s_menu_class = "1";
	if(request.getParameter("s_menu_class")!=null && !request.getParameter("s_menu_class").equals("")){
		s_menu_class = request.getParameter("s_menu_class");
	}
	ts_menuinfo.put("menu_class",s_menu_class);
	
	String s_subsys_code = "SYS";
	if(request.getParameter("s_subsys_code")!=null && !request.getParameter("s_subsys_code").equals("")){
		s_subsys_code = request.getParameter("s_subsys_code");
	}
	ts_menuinfo.put("subsys_code",s_subsys_code);

	Ts_menuinfoInfo ts_menuinfoInfo = new Ts_menuinfoInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ts_menuinfoInfo.getListByPage(ts_menuinfo,Integer.parseInt(iStart),limit);
	int counter = ts_menuinfoInfo.getCountByObj(ts_menuinfo);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?iStart=",Integer.parseInt(iStart),limit);
%>
<html>
  <head>
    
    <title>菜单配置</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="/js/commen.js"></script>
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>菜单配置</h1>
			</td>
			<td>
				<a href="addInfo.jsp?s_up_menu_id=<%=s_up_menu_id%>&s_menu_class=<%=Integer.parseInt(s_menu_class)%>&s_subsys_code=<%=s_subsys_code%>"><img src="/program/admin/index/images/post.gif" /></a>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">
	
	<!--
	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>-----------------</h4>
		  <span>1----------------。</span><br/>
		  <span>2----------------。</span>
		  </td>
        </tr>
      </table>
      <br/>
	  -->
	  
	<table width="100%" cellpadding="0" cellspacing="0" class="dl_su">
		<tr>
			<td align="left" >
				菜单名称:<input name="s_menu_name" type="text" />
				菜单类型:<select name="s_subsys_code">
				<option value="SYS">管理员后台</option>
				<option value="B2B">会员后台</option>
				</select>
				<input name="searchInfo" type="submit" value="查询"/>	
			</td>
		</tr>
	</table>

	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="listtab" border="0">
		<tr>
			<th width="5%" align="center"><input type="checkbox" name="checkall" id="checkall" onclick="selectAll()"></th>
		  	
		  	<th>菜单名称</th>
		  	
		  	<th>上级菜单</th>
			
		  	<th>菜单级别</th>
			
			<th>显示/隐藏</th>
			
			<th>添加下级菜单</th>

		  	
			<th width="10%">修改</th>
	  		<th width="10%">删除</th>
		</tr>
		
		
		<% 
		  		for(int i=0;i<list.size();i++){
		  			Hashtable map = (Hashtable)list.get(i);
		  			String subsys_code="",menu_id="",menu_name="",up_menu_id="",menu_class="",menu_type="",module_id="",in_param_code1="",in_param_value1="",in_param_code2="",in_param_value2="",in_param_code3="",in_param_value3="",remove_tag="",rsrv_str1="",rsrv_str2="",rsrv_str3="",rsrv_str4="",rsrv_str5="",rsrv_str6="",rsrv_str7="",rsrv_str8="",rsrv_str9="",rsrv_str0="",in_staff_id="",in_date="",remark="";
					String up_menu_name = "无上级";
					
	if(map.get("up_menu_name")!=null) up_menu_name = map.get("up_menu_name").toString();				
	if(map.get("subsys_code")!=null) subsys_code = map.get("subsys_code").toString();
  	if(map.get("menu_id")!=null) menu_id = map.get("menu_id").toString();
  	if(map.get("menu_name")!=null) menu_name = map.get("menu_name").toString();
  	if(map.get("up_menu_id")!=null) up_menu_id = map.get("up_menu_id").toString().trim();
  	if(map.get("menu_class")!=null) menu_class = map.get("menu_class").toString();
  	if(map.get("menu_type")!=null) menu_type = map.get("menu_type").toString();
  	if(map.get("module_id")!=null) module_id = map.get("module_id").toString();
  	if(map.get("in_param_code1")!=null) in_param_code1 = map.get("in_param_code1").toString();
  	if(map.get("in_param_value1")!=null) in_param_value1 = map.get("in_param_value1").toString();
  	if(map.get("in_param_code2")!=null) in_param_code2 = map.get("in_param_code2").toString();
  	if(map.get("in_param_value2")!=null) in_param_value2 = map.get("in_param_value2").toString();
  	if(map.get("in_param_code3")!=null) in_param_code3 = map.get("in_param_code3").toString();
  	if(map.get("in_param_value3")!=null) in_param_value3 = map.get("in_param_value3").toString();
  	if(map.get("remove_tag")!=null) remove_tag = map.get("remove_tag").toString();
  	if(map.get("rsrv_str1")!=null) rsrv_str1 = map.get("rsrv_str1").toString();
  	if(map.get("rsrv_str2")!=null) rsrv_str2 = map.get("rsrv_str2").toString();
  	if(map.get("rsrv_str3")!=null) rsrv_str3 = map.get("rsrv_str3").toString();
  	if(map.get("rsrv_str4")!=null) rsrv_str4 = map.get("rsrv_str4").toString();
  	if(map.get("rsrv_str5")!=null) rsrv_str5 = map.get("rsrv_str5").toString();
  	if(map.get("rsrv_str6")!=null) rsrv_str6 = map.get("rsrv_str6").toString();
  	if(map.get("rsrv_str7")!=null) rsrv_str7 = map.get("rsrv_str7").toString();
  	if(map.get("rsrv_str8")!=null) rsrv_str8 = map.get("rsrv_str8").toString();
  	if(map.get("rsrv_str9")!=null) rsrv_str9 = map.get("rsrv_str9").toString();
  	if(map.get("rsrv_str0")!=null) rsrv_str0 = map.get("rsrv_str0").toString();
  	if(map.get("in_staff_id")!=null) in_staff_id = map.get("in_staff_id").toString();
  	if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
if(in_date.length()>19)in_date=in_date.substring(0,19);
  	if(map.get("remark")!=null) remark = map.get("remark").toString();
	
	String is_display = "显示";
	
	if(remove_tag.equals("2")){
		is_display = "隐藏";
	}
	
	int is_exist = ts_menuinfoInfo.getMenuByUpId(menu_id).size();
	int menu_class_int = Integer.parseInt(menu_class);
	

		  %>
		
		<tr>
			<td width="5%" align="center"><input type="checkbox" name="checkone<%=i %>" id="checkone<%=i %>" value="<%=menu_id%>" /></td>
			
		  	
		  	<td> 
		  		
			<%if(menu_class_int < 3 && is_exist > 0) {%>
			<a href="index.jsp?s_up_menu_id=<%=menu_id%>&s_subsys_code=<%=s_subsys_code%>&s_menu_class=<%=Integer.parseInt(menu_class)+1%>"><img src="/program/admin/images/1.gif" border="0" style="cursor:pointer;"/><%=menu_name%></a>
			<%} else {%>
			<%=menu_name%>
			<%}%>
			</td>
		  	
		  	<td><%=up_menu_name%></td>
		  	
		  	<td><%=menu_class%></td>
			
			<td><%=is_display%></td>
			
			
			
			<td>&nbsp;
			<%if(menu_class_int < 3) {%>
			<a href="/program/admin/menu/addInfo.jsp?s_up_menu_id=<%=menu_id%>&s_menu_class=<%=Integer.parseInt(menu_class)+1%>&s_subsys_code=<%=subsys_code%>" title="新增子菜单"><img src="/program/admin/images/add.gif" border="0" style="cursor:pointer;" /></a>
			<%} else {%>
			系统暂不支持四级菜单
			<%}%>
			</td>
			<td width="10%"><a href="updateInfo.jsp?menu_id=<%=menu_id %>"><img src="/program/admin/images/edit.gif" title="修改" /></a></td>
	  		<td width="10%"><a href="javascript:deleteOneInfo('<%=menu_id%>','0979');"><img src="/program/admin/images/delete.gif" title="删除" /></a></td>
		</tr>
		
		  <%
		  		}
		  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
				<input type="button" name="delInfo" onclick="delIndexInfo()" value="删除" class="buttab"/>
			</td>
			<td>
				总计:<%=counter %>条
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="tablehe">
		<tr><td><%=pageString %></td></tr>
	</table>
	
	<%
		 }
	%>
	<%if(Integer.parseInt(s_menu_class) > 1) {%>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	<%}%>
	
	  <input type="hidden" name="listsize" id="listsize" value="<%=listsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="0979" />
	  </form>
</body>

</html>
